package com.qf.oop.dt;

public class Round extends Graphical {

    private String name; // 名字
    private int r; // 半径
    private double c; // 周长
    private double area; // 面积


    /**
     * 初始化并且计算周长和面积
     */
    public Round() {
        this.setName("圆");
        this.setR(1);
        calcArea();
        calcPerimeter();
    }

    /**
     * 打印信息
     */
    public void printInfo() {
        System.out.print("名称:" + getName());
        System.out.print(" 半径:" + getR());
        System.out.print(" 周长:" + getC());
        System.out.println(" 面积:" + getArea());
    }

    /**
     * 计算周长
     */
    public void calcPerimeter() {
        setC(2 * r * 3.14);
    }

    /**
     * 计算面积
     */
    public void calcArea() {
        setArea(3.14 * r * r);
    }

    public Round(String name, int r, double c, double area) {
        this.name = name;
        this.r = r;
        this.c = c;
        this.area = area;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getR() {
        return r;
    }

    public void setR(int r) {
        this.r = r;
    }

    public double getC() {
        return c;
    }

    public void setC(double c) {
        this.c = c;
    }

    public double getArea() {
        return area;
    }

    public void setArea(double area) {
        this.area = area;
    }
}
